<?
require_once 'config.inc.php'; 

if (empty($_SESSION["username"])){
	header("Location:./admin/login.php?referer=". $_SERVER['REQUEST_URI']);
}
if ($_GET['id']) {
	$id = intval($_GET['id']);
	$sql = "SELECT * FROM {$tablepre}note WHERE id = $id ";
	$result=mysql_query($sql); 
	$enotes = mysql_fetch_array($result,MYSQL_ASSOC);
	if(!$enotes){
		//showmsg("{$model_name}资料不存在",'错误',"../frmView_right.php",'返回');
		pecho("{$model_name}资料不存在");
		exit();
	}
	
	
	if(strstr($enotes['copyform'],'http://') || strstr($enotes['copyform'],'https://')){
		$enotes['copyform'] = '<a href="'.$enotes['copyform'].'" target=_blank>'. $enotes['copyform'].'</a>';
	}
	$enotes['keywords'] = tags($enotes['keywords']);
	
	$sql = "UPDATE {$tablepre}note SET hit=hit+1  WHERE id = $id ";
	mysql_query($sql);
	
	$nav = get_nav($enotes['cid']);
	$nav .= $enotes['title'];
	
	
	
	
	
	
}

?>
<link rel="stylesheet" type="text/css" href="images/style.css">
<link rel="stylesheet" type="text/css" href="images/note.css">

<div id="nav">

	<div class="left">分类：<?php echo $nav ?></div>
	<div class="right"><a href="admin/admin_note.php">[添加]</a> <a href="admin/admin_note.php?id=<?php echo $enotes[id] ?>">[编辑]</a>
	<a href="view_note.php?id=<?php echo $enotes[id] ?>" target="_blank" >[新窗口查看]</a>
	<a href="admin/admin_note.php?action=del&id=<?php echo $enotes[id] ?>" onclick="return confirm('Are you sure you want to delete?')">[删除]</a>
    <a href="view_note.php?id=<?php echo $enotes[id] ?>" target="" >[重新载入]</a></div>

</div>

<div class="doc_content_box">
    <div class="doc_content">
        <h1 class="title"><?php echo  $enotes['title'] ?></h1>
        <h4 class="copyfrom">来源：<?php echo  $enotes['copyform'] ?></h4>
        <h4 class="keywords">关键词：<?php echo  $enotes['keywords'] ?></h4>   
        
        <?php echo $enotes['content']?>
        <h4 class="create_time">创建日期：<?php echo  format_date('m/d/Y h:i:s A',null,$enotes['create_time']) ?></h4>   
        <h4 class="update_time">最后更新：<?php echo  format_date('m/d/Y h:i:s A',null,$enotes['update_time']) ?></h4>   
        <h4 class="update_time">访问次数：<?php echo $enotes['hit'] ?></h4>   
        
    </div>
</div>
  
<?
require_once 'foot.inc.php';
?>